package com.neusoft.mapper;

import java.util.List;

import org.apache.ibatis.annotations.*;

import com.neusoft.po.Cart;

@Mapper
public interface CartMapper {
    @Select("select * from cart where userId=#{userId} and businessId=#{businessId}")
	public List<Cart> listCart(Cart cart);
	
	@Insert("insert into cart values(null,#{foodId},#{businessId},#{userId},1)")
	public int saveCart(@Param("foodId") Integer foodId,
						@Param("businessId") Integer businessId,
						@Param("userId") String userId);

	@Update("update cart set quantity=#{quantity} where foodId=#{foodId} and businessId=#{businessId} and userId=#{userId}")
	public int updateCart(Cart cart);


	@Delete("DELETE FROM cart " +
			"WHERE foodId = #{foodId} AND businessId = #{businessId} AND userId = #{userId}")
	public int removeCart(Cart cart);

}
